<template>
  <el-dialog
    :title="'业务进度查询'"
    width="100%"
        top="0px"
    :fullscreen="true"
    :close-on-click-modal="false"
    :visible.sync="visible">
  <div class="mod-config">
    <el-form  :model="dataForm"  label-width="170px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="业务类型" prop="ywlx" class="label_font">
            <el-input v-model="dataForm.ywlx" placeholder="业务类型" style="width:100%"  readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="业务标识码" prop="servicecode" class="label_font">
            <el-input v-model="dataForm.servicecode" placeholder="业务标识码"  style="width:100%" readonly ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
       <el-row>
        <el-col :span="12">
          <el-form-item label="不动产坐落" prop="zl" class="label_font">
            <el-input v-model="dataForm.zl" placeholder="不动产坐落"  style="width:100%" readonly ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
              <el-form-item  >
              <el-button type="primary" @click="send0007()"  >主动查询进度</el-button>
              </el-form-item>
        </el-col>
      </el-row>

    <el-table
      :data="dataList"
      border
      v-loading="dataListLoading"
      @selection-change="selectionChangeHandle"
      style="width: 100%;">

      <el-table-column
        prop="proctime"
        header-align="center"
        align="center"
        width="180px"
        label="操作时间">
      </el-table-column>

      <el-table-column
        prop="status"
        header-align="center"
        align="center"
        label="业务进度状态">
      </el-table-column>

      <el-table-column
        prop="username"
        header-align="center"
        align="center"
        :show-overflow-tooltip="true"
        label="操作人员">
      </el-table-column>

      <el-table-column
        prop="descinfo"
        header-align="center"
        align="center"
        label="状态描述">
      </el-table-column>

    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="datepicker.pageOptions"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>

    </el-form>


  </div>

    <span slot="footer" class="dialog-footer">

        <el-button    @click="goback()">返回</el-button>

    </span>

  </el-dialog>
</template>

<script>

  export default {
    data () {
      return {
        visible: false,
        dataForm: {
          servicecode: '',
          ywlx: '',
          zl: '',
          seqno: 0
        },
        seRegion: '',
        dataList: [],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListLoading: false,
        dataListSelections: []
      }
    },

    methods: {
       init (seqno, btype, servicecode, zl, seRegion) {
         this.visible = true
         this.dataForm.ywlx = btype
         this.dataForm.servicecode = servicecode
         this.dataForm.zl = zl
         this.dataForm.seqno = seqno
         this.seRegion = seRegion
         this.dataList = []
         this.totalPage = 0
         this.getDataList()
       },
      // 获取数据列表
      getDataList () {
        if (!this.dataForm.servicecode){
           this.$message.error("业务标识码不能为空")
           return 
        }
        this.dataListLoading = true
        this.$http({
          url: this.$http.adornUrl('/bdc/bdcprocview/list'),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.pageIndex,
            'limit': this.pageSize,
            'key': this.dataForm.seqno
          })
        }).then(({data}) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list
            this.totalPage = data.page.totalCount
          } else {
            this.dataList = []
            this.totalPage = 0
          }
          this.dataListLoading = false
        })
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },
      send0007(){
          this.$http({
              url: this.$http.adornUrl(`/bdc/bdcprocview/send`),
              method: 'post',
              data: this.$http.adornData({
                'ywbsm': this.dataForm.servicecode,
                'seRegion': this.seRegion
              })
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '主动查询进度成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.getDataList()
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
            })
      },

      goback(){
          this.visible = false
          this.$emit('refreshDataList')
      },

      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      },
      // 多选
      selectionChangeHandle (val) {
        this.dataListSelections = val
      },

      // 删除
      deleteHandle (id) {
        var ids = id ? [id] : this.dataListSelections.map(item => {
          return item.seqno
        })
        this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl('/bdc/bdcprocview/delete'),
            method: 'post',
            data: this.$http.adornData(ids, false)
          }).then(({data}) => {
            if (data && data.code === 0) {
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                  this.getDataList()
                }
              })
            } else {
              this.$message.error(data.msg)
            }
          })
        })
      }
    }
  }
</script>
